/* 
 * ConfigTag.java      1.00    2008-01-11
 *
 * Copyright (c) 2010 leewan. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information
 * of leewan.  You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license agreement
 * you entered into with leewan.
 */
package doit.framework.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import doit.framework.util.Config;

/**
 * <pre>
 * system      : 공통
 * menu        : 공통
 * source      : ConfigTag.java
 * description : config.xml read Tag
 * </pre> 
 * @version
 * <pre> 
 * 1.0  2008-01-11  leewan  최초 작성
 * 1.1  
 * </pre>
 */

public class ConfigTag extends TagSupport {

    /**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -2978312267796847618L;
	
	String key;

    public void setKey(String key) {
        this.key = key;
    }

    public int doStartTag() throws JspException {
        if (key == null) {
            key = "";
        }

        return SKIP_BODY;
    }

    public int doEndTag() throws JspException {
        try {
        	JspWriter out = pageContext.getOut();
            out.print( Config.getString( this.key));
        }
        catch (Exception e) {
            throw new JspTagException("I/O 예외 " + e.getMessage());
        }

        return EVAL_PAGE;
    }    

    public void release() {
        super.release();
        key = null;
    }
}
